package cn.jinjie.day09;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Test09 {
    public static void main(String[] args) {
        ArrayList<String> al = new ArrayList<String>();
        Collections.addAll(al, "001,周润发", "002,成龙", "003,小明", "004,刘德华", "005,吴京");

        // System.out.println(al.stream().collect(Collectors.toMap(
        //         new Function<String, String>() {
        //             @Override
        //             public String apply(String s) {
        //                 return s.split(",")[0];
        //             }
        //         },
        //         new Function<String, String>() {
        //             @Override
        //             public String apply(String s) {
        //                 return s.split(",")[1];
        //             }
        //         })));
        Map<String, String> map = al.stream().collect(Collectors.toMap(s -> s.split(",")[0], s -> s.split(",")[1]));
        System.out.println(map);
    }
}
